package com.initialize.pub.generate.dao;

import com.initialize.pub.generate.pojo.Classification;
import com.initialize.pub.generate.pojo.ClassificationExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface ClassificationMapper {
    @SelectProvider(type=ClassificationSqlProvider.class, method="countByExample")
    long countByExample(ClassificationExample example);

    @DeleteProvider(type=ClassificationSqlProvider.class, method="deleteByExample")
    int deleteByExample(ClassificationExample example);

    @Delete({
        "delete from classification",
        "where cid = #{cid,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer cid);

    @Insert({
        "insert into classification (cid, ccid, ",
        "name)",
        "values (#{cid,jdbcType=INTEGER}, #{ccid,jdbcType=INTEGER}, ",
        "#{name,jdbcType=VARCHAR})"
    })
    int insert(Classification record);

    @InsertProvider(type=ClassificationSqlProvider.class, method="insertSelective")
    int insertSelective(Classification record);

    @SelectProvider(type=ClassificationSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="cid", property="cid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="ccid", property="ccid", jdbcType=JdbcType.INTEGER),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR)
    })
    List<Classification> selectByExample(ClassificationExample example);

    @Select({
        "select",
        "cid, ccid, name",
        "from classification",
        "where cid = #{cid,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="cid", property="cid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="ccid", property="ccid", jdbcType=JdbcType.INTEGER),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR)
    })
    Classification selectByPrimaryKey(Integer cid);

    @UpdateProvider(type=ClassificationSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Classification record, @Param("example") ClassificationExample example);

    @UpdateProvider(type=ClassificationSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Classification record, @Param("example") ClassificationExample example);

    @UpdateProvider(type=ClassificationSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Classification record);

    @Update({
        "update classification",
        "set ccid = #{ccid,jdbcType=INTEGER},",
          "name = #{name,jdbcType=VARCHAR}",
        "where cid = #{cid,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Classification record);
}